A database management system, or DBMS, typically stores vast amounts of data. The data is organized in tables, also known as relations. The tables include rows, also known as tuples, and columns, also known as attributes. In addition to the data itself, the DBMS may include data structures of various types that facilitate efficient query processing.
For example, a view is a table that is derived by specifying a query, such as a join operation, on one or more base tables. Each time the view is referenced, the query is typically recomputed. A materialized view, by contrast, is a view that need not be recomputed, but is stored in the DBMS.
A materialized view is constructed from a query specification and the data from base table(s) referenced by the query. The DBMS stores the results of the query specification in the materialized view. In a typical DBMS, different materialized views may be maintained.
Where queries can be answered by referring to the pre-computed result in the materialized view, the query is answered much more quickly than if the results were computed from the base tables themselves. In this way, the materialized view provides an alternative access path for certain queries.
Like a cache, data within the materialized view becomes stale as the content of base tables change. For example, as new data is added to a base table, the materialized view constructed from the base table is updated as well. This is known as materialized view maintenance. Materialized view maintenance typically adds significantly to the overhead of the DBMS.
Two types of operations within a DBMS are related to materialized views. First, in response to a query involving base tables, a materialized view produces the desired result if the result is contained in the materialized view. Second, modification of a base table may or may not cause the materialized view to become stale. To support and use materialized views efficiently in a DBMS, a determination must be made whether the row set resulting from one search condition is contained in another row set resulting from another search condition. Maintenance of the materialized view sometimes involves substantial oversight by the DBMS.